//
//  Department.m
//  Contacts
//
//  Created by 李 雷川 on 14-7-18.
//  Copyright (c) 2014年 李 雷川. All rights reserved.
//

#import "Department.h"
#import "DepartmentDao.h"

@implementation Department
@synthesize ID,name,contacts,sort;

+(BOOL)saveDepartment:(Department *)department{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    BOOL success  =[dao insertDepartment:department];
    return success;
}

+(BOOL)updateDepartment:(Department *)department{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    BOOL success  =[dao insertDepartment:department];
    return success;
}

+(BOOL)saveDepartments:(NSArray *)departments{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    BOOL success  =[dao insertDepartments:departments];
    return success;
}

+(BOOL)deleteDepartment:(Department *)department{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    BOOL success  =[dao insertDepartment:department];
    return success;
}

+(BOOL)updateDepartments:(NSArray *)departments{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    BOOL success  =[dao upateDepartments:departments];
    return success;
}

+(NSArray *)getDepartments{
    DepartmentDao *dao = [[DepartmentDao alloc]init];
    NSArray *departments  =[dao getDepartments];
    return departments;
}
@end
